home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / champbas.c < prev    next >
C/C++ Source or Header  |  2000-05-23  |  11KB  |  350 lines

  1. /***************************************************************************
  2.  
  3. Championship Baseball
  4.  
  5. driver by Nicola Salmoria
  6.  
  7. TODO:
  8. champbbj and champbb2 don't work due to protection - a custom mcu probably.
  9. The protection involves locations a006-a007 and 6000-63ff.  It pulls
  10. addresses to routines from there.
  11.  
  12.  
  13. 0000-5fff ROM
  14. 7800-7fff ROM (Champion Baseball 2 only)
  15. 8000-83ff Video RAM
  16. 8400-87ff Color RAM
  17. 8800-8fff RAM
  18.  
  19. read:
  20. a000      IN0
  21. a040      IN1
  22. a080      DSW
  23. a0a0      ?
  24. a0c0      COIN
  25.  
  26. write:
  27. 7000      8910 write
  28. 7001      8910 control
  29. 8ff0-8fff sprites
  30. a000      ?
  31. a060-a06f sprites
  32. a080      command for the sound CPU
  33. a0c0      watchdog reset???
  34.  
  35.  
  36. The second CPU plays speech
  37.  
  38. ***************************************************************************/
  39.  
  40. #include "driver.h"
  41. #include "vidhrdw/generic.h"
  42.  
  43.  
  44.  
  45. void champbas_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  46. WRITE_HANDLER( champbas_gfxbank_w );
  47. void champbas_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  48.  
  49.  
  50.  
  51. WRITE_HANDLER( champbas_dac_w )
  52. {
  53.     DAC_signed_data_w(0,data<<2);
  54. }
  55.  
  56.  
  57. static struct MemoryReadAddress readmem[] =
  58. {
  59.     { 0x0000, 0x5fff, MRA_ROM },
  60.     { 0x7800, 0x7fff, MRA_ROM },
  61.     { 0x8000, 0x8fff, MRA_RAM },
  62.     { 0xa000, 0xa000, input_port_0_r },
  63.     { 0xa040, 0xa040, input_port_1_r },
  64.     { 0xa080, 0xa080, input_port_2_r },
  65. /*    { 0xa0a0, 0xa0a0,  },    ???? */
  66.     { 0xa0c0, 0xa0c0, input_port_3_r },
  67.     { -1 }    /* end of table */
  68. };
  69.  
  70. static struct MemoryWriteAddress writemem[] =
  71. {
  72.     { 0x0000, 0x5fff, MWA_ROM },
  73.     { 0x7000, 0x7000, AY8910_write_port_0_w },
  74.     { 0x7001, 0x7001, AY8910_control_port_0_w },
  75.     { 0x7800, 0x7fff, MWA_ROM },
  76.     { 0x8000, 0x83ff, videoram_w, &videoram, &videoram_size },
  77.     { 0x8400, 0x87ff, colorram_w, &colorram },
  78.     { 0x8800, 0x8fef, MWA_RAM },
  79.     { 0x8ff0, 0x8fff, MWA_RAM, &spriteram, &spriteram_size},
  80.     { 0xa000, 0xa000, interrupt_enable_w },
  81.     { 0xa002, 0xa002, champbas_gfxbank_w },
  82.     { 0xa060, 0xa06f, MWA_RAM, &spriteram_2 },
  83.     { 0xa080, 0xa080, soundlatch_w },
  84.     { 0xa0c0, 0xa0c0, watchdog_reset_w },
  85.     { -1 }    /* end of table */
  86. };
  87.  
  88. static struct MemoryReadAddress readmem2[] =
  89. {
  90.     { 0x0000, 0x5fff, MRA_ROM },
  91.     { 0x6000, 0x6000, soundlatch_r },
  92.     { 0xe000, 0xe3ff, MRA_RAM },
  93.     { -1 }    /* end of table */
  94. };
  95.  
  96. static struct MemoryWriteAddress writemem2[] =
  97. {
  98.     { 0x0000, 0x5fff, MWA_ROM },
  99. /*    { 0x8000, 0x8000, MWA_NOP },    unknown - maybe DAC enable */
  100.     { 0xa000, 0xa000, soundlatch_w },    /* probably. The sound latch has to be cleared some way */
  101.     { 0xc000, 0xc000, champbas_dac_w },
  102.     { 0xe000, 0xe3ff, MWA_RAM },
  103.     { -1 }    /* end of table */
  104. };
  105.  
  106.  
  107.  
  108. INPUT_PORTS_START( champbas )
  109.     PORT_START    /* IN0 */
  110.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
  111.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
  112.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 )
  113.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 )
  114.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
  115.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  116.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  117.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
  118.  
  119.     PORT_START    /* IN1 */
  120.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  121.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  122.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_COCKTAIL )
  123.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_COCKTAIL )
  124.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
  125.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
  126.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  127.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
  128.  
  129.     PORT_START    /* DSW */
  130.     PORT_DIPNAME( 0x03, 0x02, DEF_STR( Coinage ) )
  131.     PORT_DIPSETTING(    0x03, "A 2/1 B 3/2" )
  132.     PORT_DIPSETTING(    0x02, "A 1/1 B 2/1")
  133.     PORT_DIPSETTING(    0x01, "A 1/2 B 1/6" )
  134.     PORT_DIPSETTING(    0x00, "A 1/3 B 1/6")
  135.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Flip_Screen ) )
  136.     PORT_DIPSETTING(    0x00, DEF_STR( Off ))
  137.     PORT_DIPSETTING(    0x04, DEF_STR( On ) )
  138.     PORT_DIPNAME( 0x08, 0x00, DEF_STR( Demo_Sounds ) )
  139.     PORT_DIPSETTING(    0x08, DEF_STR( Off ))
  140.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  141.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Cabinet ) )
  142.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ))
  143.     PORT_DIPSETTING(    0x10, DEF_STR( Cocktail ) )
  144.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Difficulty ) )
  145.     PORT_DIPSETTING(    0x20, "Easy" )
  146.     PORT_DIPSETTING(    0x00, "Hard")
  147.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
  148.     PORT_DIPSETTING(    0x00, DEF_STR( Off ))
  149.     PORT_DIPSETTING(    0x40, DEF_STR( On ) )
  150.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) /* The game won't boot if set to ON */
  151.     PORT_DIPSETTING(    0x00, DEF_STR( Off ))
  152.     PORT_DIPSETTING(    0x80, DEF_STR( On ) )
  153.  
  154.     PORT_START    /* COIN */
  155.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
  156.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
  157.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
  158.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 )
  159.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
  160.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  161.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  162.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  163.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  164. INPUT_PORTS_END
  165.  
  166.  
  167.  
  168. static struct GfxLayout charlayout =
  169. {
  170.     8,8,    /* 8*8 characters */
  171.     256,    /* 256 characters */
  172.     2,    /* 2 bits per pixel */
  173.     { 0, 4 },    /* the two bitplanes for 4 pixels are packed into one byte */
  174.     { 8*8+0, 8*8+1, 8*8+2, 8*8+3, 0, 1, 2, 3 },    /* bits are packed in groups of four */
  175.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  176.     16*8    /* every char takes 16 bytes */
  177. };
  178.  
  179. static struct GfxLayout spritelayout =
  180. {
  181.     16,16,    /* 16*16 sprites */
  182.     64,    /* 64 sprites */
  183.     2,    /* 2 bits per pixel */
  184.     { 0, 4 },    /* the two bitplanes for 4 pixels are packed into one byte */
  185.     { 8*8, 8*8+1, 8*8+2, 8*8+3, 16*8+0, 16*8+1, 16*8+2, 16*8+3,
  186.             24*8+0, 24*8+1, 24*8+2, 24*8+3, 0, 1, 2, 3 },
  187.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  188.             32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8 },
  189.     64*8    /* every sprite takes 64 bytes */
  190. };
  191.  
  192. static struct GfxDecodeInfo gfxdecodeinfo[] =
  193. {
  194.     { REGION_GFX1, 0x0000, &charlayout,   0, 64 },
  195.     { REGION_GFX2, 0x0000, &charlayout,   0, 64 },
  196.     { REGION_GFX1, 0x1000, &spritelayout, 0, 64 },
  197.     { REGION_GFX2, 0x1000, &spritelayout, 0, 64 },
  198.     { -1 } /* end of array */
  199. };
  200.  
  201.  
  202.  
  203.  
  204. static struct AY8910interface ay8910_interface =
  205. {
  206.     1,    /* 1 chip */
  207.     1500000,    /* 1.5 MHz ? */
  208.     { 30 },
  209.     { input_port_0_r },
  210.     { input_port_1_r },
  211.     { 0 },
  212.     { 0 }
  213. };
  214.  
  215. static struct DACinterface dac_interface =
  216. {
  217.     1,
  218.     { 70 }
  219. };
  220.  
  221.  
  222.  
  223. static struct MachineDriver machine_driver_champbas =
  224. {
  225.     /* basic machine hardware */
  226.     {
  227.         {
  228.             CPU_Z80,
  229.             3072000,    /* 3.072 Mhz (?) */
  230.             readmem,writemem,0,0,
  231.             interrupt,1
  232.         },
  233.         {
  234.             CPU_Z80 | CPU_AUDIO_CPU,
  235.             3072000,    /* 3.072 Mhz ? */
  236.             readmem2,writemem2,0,0,
  237.             ignore_interrupt,1
  238.         }
  239.     },
  240.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  241.     1,    /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  242.     0,
  243.  
  244.     /* video hardware */
  245.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  246.     gfxdecodeinfo,
  247.     32,64*4,
  248.     champbas_vh_convert_color_prom,
  249.  
  250.     VIDEO_TYPE_RASTER|VIDEO_SUPPORTS_DIRTY,
  251.     0,
  252.     generic_vh_start,
  253.     generic_vh_stop,
  254.     champbas_vh_screenrefresh,
  255.  
  256.     /* sound hardware */
  257.     0,0,0,0,
  258.     {
  259.         {
  260.             SOUND_AY8910,
  261.             &ay8910_interface
  262.         },
  263.         {
  264.             SOUND_DAC,
  265.             &dac_interface
  266.         }
  267.     }
  268. };
  269.  
  270.  
  271.  
  272. /***************************************************************************
  273.  
  274.   Game driver(s)
  275.  
  276. ***************************************************************************/
  277.  
  278. ROM_START( champbas )
  279.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  280.     ROM_LOAD( "champbb.1",    0x0000, 0x2000, 0x218de21e )
  281.     ROM_LOAD( "champbb.2",    0x2000, 0x2000, 0x5ddd872e )
  282.     ROM_LOAD( "champbb.3",    0x4000, 0x2000, 0xf39a7046 )
  283.  
  284.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the speech CPU */
  285.     ROM_LOAD( "champbb.6",    0x0000, 0x2000, 0x26ab3e16 )
  286.     ROM_LOAD( "champbb.7",    0x2000, 0x2000, 0x7c01715f )
  287.     ROM_LOAD( "champbb.8",    0x4000, 0x2000, 0x3c911786 )
  288.  
  289.     ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  290.     ROM_LOAD( "champbb.4",    0x0000, 0x2000, 0x1930fb52 )
  291.  
  292.     ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  293.     ROM_LOAD( "champbb.5",    0x0000, 0x2000, 0xa4cef5a1 )
  294.  
  295.     ROM_REGION( 0x0120, REGION_PROMS )
  296.     ROM_LOAD( "champbb.pr2",  0x0000, 0x020, 0x2585ffb0 ) /* palette */
  297.     ROM_LOAD( "champbb.pr1",  0x0020, 0x100, 0x872dd450 ) /* look-up table */
  298. ROM_END
  299.  
  300. ROM_START( champbbj )
  301.     ROM_REGION( 0x10000, REGION_CPU1 ) /* 64k for code */
  302.     ROM_LOAD( "11.2e",      0x0000, 0x2000, 0xe2dfc166 )
  303.     ROM_LOAD( "12.2g",      0x2000, 0x2000, 0x7b4e5faa )
  304.     ROM_LOAD( "13.2h",      0x4000, 0x2000, 0xb201e31f )
  305.  
  306.     ROM_REGION( 0x10000, REGION_CPU2 ) /* 64k for the speech CPU */
  307.     ROM_LOAD( "16.2k",      0x0000, 0x2000, 0x24c482ee )
  308.     ROM_LOAD( "17.2l",      0x2000, 0x2000, 0xf10b148b )
  309.     ROM_LOAD( "18.2n",      0x4000, 0x2000, 0x2dc484dd )
  310.  
  311.     ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  312.     ROM_LOAD( "14.5e",      0x0000, 0x2000, 0x1b8202b3 )
  313.  
  314.     ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  315.     ROM_LOAD( "15.5g",      0x0000, 0x2000, 0xa67c0c40 )
  316.  
  317.     ROM_REGION( 0x0120, REGION_PROMS )
  318.     ROM_LOAD( "1e.bpr",    0x0000, 0x0020, 0xf5ce825e ) /* palette */
  319.     ROM_LOAD( "5k.bpr",    0x0020, 0x0100, 0x2e481ffa ) /* look-up table */
  320. ROM_END
  321.  
  322. ROM_START( champbb2 )
  323.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  324.     ROM_LOAD( "epr5932",      0x0000, 0x2000, 0x528e3c78 )
  325.     ROM_LOAD( "epr5929",      0x2000, 0x2000, 0x17b6057e )
  326.     ROM_LOAD( "epr5930",      0x4000, 0x2000, 0xb6570a90 )
  327.     ROM_LOAD( "epr5931",      0x7800, 0x0800, 0x0592434d )
  328.  
  329.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the speech CPU */
  330.     ROM_LOAD( "epr5933",      0x0000, 0x2000, 0x26ab3e16 )
  331.     ROM_LOAD( "epr5934",      0x2000, 0x2000, 0x7c01715f )
  332.     ROM_LOAD( "epr5935",      0x4000, 0x2000, 0x3c911786 )
  333.  
  334.     ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  335.     ROM_LOAD( "epr5936",      0x0000, 0x2000, 0xc4a4df75 )
  336.  
  337.     ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  338.     ROM_LOAD( "epr5937",      0x0000, 0x2000, 0x5c80ec42 )
  339.  
  340.     ROM_REGION( 0x0120, REGION_PROMS )
  341.     ROM_LOAD( "pr5957",       0x0000, 0x020, 0xf5ce825e ) /* palette */
  342.     ROM_LOAD( "pr5956",       0x0020, 0x100, 0x872dd450 ) /* look-up table */
  343. ROM_END
  344.  
  345.  
  346.  
  347. GAME( 1983, champbas, 0,        champbas, champbas, 0, ROT0, "Sega", "Champion Baseball" )
  348. GAMEX(1983, champbbj, champbas, champbas, champbas, 0, ROT0, "Alpha Denshi Co.", "Champion Baseball (Japan)", GAME_NOT_WORKING )
  349. GAMEX(1983, champbb2, 0,        champbas, champbas, 0, ROT0, "Sega", "Champion Baseball II", GAME_NOT_WORKING )
  350.